Skip to content

Conversation

@baronfel
Copy link
Member

@baronfel baronfel commented Nov 3, 2025

Context

Some of the node commmunication data is hard to unpack, e.g. arrays are stringified as System.String[] instead of useful content.

Here's a sample:

 (TID 1) 638975452648927540 +     6.825ms: Command line parameters: System.String[]
.NET TP Worker (TID 4) 638975452664083250 +  1477.307ms: Starting to acquire 1 new or existing node(s) to establish nodes from ID 2 to 2...
.NET TP Worker (TID 4) 638975452664605130 +    52.188ms: Building handshake for node type NodeReuse, Arm64, (version 1): options 16777352.
.NET TP Worker (TID 4) 638975452664643740 +     3.861ms: Handshake salt is 

On this sample log,

  • the parameters are the array type name
  • the handshake node options are encoded
  • the salt is empty but it's unclear if that's intentional

Changes Made

This small change correctly renders the command lines args for the node that's tracking communication, as well as the handshake options for easier reading.

Here's the 'after':

 (TID 1) 638977828182753790 +    49.029ms: Command line parameters: "/Users/chethusk/code/msbuild/artifacts/bin/bootstrap/core/sdk/10.0.100-rc.2.25466.101/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false"
OutOfProc Endpoint Packet Pump (TID 5) 638977828209647270 +     2.657ms: Waiting for connection 900000 ms...
OutOfProc Endpoint Packet Pump (TID 5) 638977828209678460 +     3.119ms: Parent started connecting. Reading handshake from parent
OutOfProc Endpoint Packet Pump (TID 5) 638977828209936360 +     25.79ms: Building handshake for node type NodeReuse, Arm64, (version 1): options NodeReuse,Arm64.
OutOfProc Endpoint Packet Pump (TID 5) 638977828210022560 +      8.62ms: Handshake salt is <not specified>

Testing

Notes

@baronfel baronfel requested a review from a team as a code owner November 3, 2025 17:40
Copilot AI review requested due to automatic review settings November 3, 2025 17:40
</PropertyGroup>
<PropertyGroup>
<BootstrapSdkVersion>10.0.100-rc.1.25451.107</BootstrapSdkVersion>
<BootstrapSdkVersion>10.0.100-rc.2.25466.101</BootstrapSdkVersion>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strictly speaking this is not necessary

// Calculate salt from environment and tools directory
bool isNetTaskHost = IsHandshakeOptionEnabled(nodeType, NetTaskHostFlags);
string handshakeSalt = Environment.GetEnvironmentVariable("MSBUILDNODEHANDSHAKESALT") ?? "";
string handshakeSalt = Environment.GetEnvironmentVariable("MSBUILDNODEHANDSHAKESALT");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coalescing to empty string here makes it more annoying to do a clearer message string later, so let's leave it null for just a couple more lines.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves logging and tracing for command-line parameters and handshake options in MSBuild, and updates the bootstrap SDK version. The changes enhance debugging visibility by making trace output more informative and readable.

  • Improves handshake options logging to show individual flag names instead of combined integer values
  • Enhances command-line parameter tracing and environment variable handling with better null handling
  • Updates bootstrap SDK version to rc.2

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/Shared/CommunicationsUtilities.cs Adds method to enumerate individual handshake options for better logging, improves trace output formatting, and enhances null handling for environment variables
src/MSBuild/XMake.cs Updates command-line parameter tracing to properly format the string output
eng/Versions.props Updates BootstrapSdkVersion from rc.1 to rc.2

GatherAllSwitches(commandLine, out var switchesFromAutoResponseFile, out var switchesNotFromAutoResponseFile, out _);

CommunicationsUtilities.Trace($"Command line parameters: {commandLine}");
CommunicationsUtilities.Trace($"Command line parameters: \"{string.Join(' ', commandLine)}\"");
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commandLine parameter is a string, not a collection. Using string.Join(' ', commandLine) will join individual characters with spaces instead of displaying the command line. Remove the string.Join call and use commandLine directly: CommunicationsUtilities.Trace($\"Command line parameters: \\\"{commandLine}\\\"\");

Suggested change
CommunicationsUtilities.Trace($"Command line parameters: \"{string.Join(' ', commandLine)}\"");
CommunicationsUtilities.Trace($"Command line parameters: \"{commandLine}\"");

Copilot uses AI. Check for mistakes.
@rainersigwald
Copy link
Member

Can you show the text of your bad logs? I am a bit surprised that they got so mangled--maybe #12693 fixed it?

@baronfel
Copy link
Member Author

baronfel commented Nov 3, 2025

You bet - just updated the description with a snippet showing the 'before' and 'after' scenarios.

@baronfel
Copy link
Member Author

baronfel commented Nov 3, 2025

You're right - that other PR obviated most of this.

@baronfel baronfel closed this Nov 3, 2025
@baronfel baronfel deleted the node-spawn-logging branch November 3, 2025 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants